package cn.tedu.carehome.foundation.controller;

import cn.tedu.carehome.foundation.pojo.vo.RoleListItemVO;
import cn.tedu.carehome.foundation.service.IRoleService;
import cn.tedu.carehome.foundation.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/roles")
@Slf4j
@Api(tags = "角色管理")
public class RoleController{
    public RoleController(){
        log.debug("创建控制类对象：RoleController");
    }
    @Autowired
    private IRoleService roleService;
    @GetMapping
    @ApiOperation("查询角色列表")
    @ApiOperationSupport(order = 400)
    public JsonResult<List<RoleListItemVO>> list(){
        log.debug("开始执行查询角色列表的请求");
        List<RoleListItemVO> list = roleService.list();
        return JsonResult.ok(list);
    }
}
